﻿Public Class FormBajaTorneo
    Private _miCampeonato As Campeonato
    Private _idTorneaAEliminar As Integer

    Public Property idTorneoAEliminar As Integer
        Get
            Return Me._idTorneaAEliminar
        End Get
        Set(value As Integer)
            Me._idTorneaAEliminar = value
        End Set
    End Property

    Private Sub FormBajaTorneo_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.MdiParent = FormEntrada
        Me._miCampeonato = New Campeonato
    End Sub

    Private Sub btnBuscarTorneo_Click(sender As Object, e As EventArgs) Handles btnBuscarTorneo.Click
        FormBuscarTorneo.Show()
        FormBuscarTorneo.formularioDestino = "FormBajaTorneo"
    End Sub

    Private Sub btnBajaAceptar_Click(sender As Object, e As EventArgs) Handles btnBajaAceptar.Click
        Dim camporelleno As Boolean = True

        If tbxBajaNombreTorneo.Text.Length = 0 Then
            ErrorProvider1.SetError(tbxBajaNombreTorneo, "Los capos nopeden estar vacios")
        Else
            ErrorProvider1.SetError(tbxBajaNombreTorneo, Nothing)
            camporelleno = True
        End If
        If camporelleno = True Then
            Me._miCampeonato.eliminarTorneo(Me._idTorneaAEliminar)
        End If
    End Sub

    Private Sub btnBajaCancelar_Click(sender As Object, e As EventArgs) Handles btnBajaCancelar.Click
        Me.Close()
    End Sub
End Class